<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <title>审批</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <style type="text/css">
        div.col-sm-3.text-left, div.col-sm-10.text-left{
            color:#949494;
        }
    </style>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>审批</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#"><i class="active"></i>交易</a></li>
            <li class="active"><a href="#"><i class="active"></i>备案采购</a></li>
            <li class="active"><a href="#"><i class="active"></i>备案审批</a></li>
        </ol>
    </section>
    <section class="content">
    <div class=" box box-success ">
    
            <!-- form start -->
            <form role="form" class="form-horizontal">
                <div class="box-body">
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter1" class="col-sm-2 text-right">药品编码：</label>
                        <div class="col-sm-3 text-left">
                            <c:out value="${detail.drugCode}" />
                        </div>
                        <label for="inputTextAlter1" class="col-sm-2 text-right">通用名：</label>
                        <div class="col-sm-3 text-left">
                            <c:out value="${detail.drugName}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter1" class="col-sm-2 text-right">商品名：</label>
                        <div class="col-sm-3 text-left">
                                 <c:out value="${detail.busName}" />
                        </div>
                        <label for="inputTextAlter2" class="col-sm-2 text-right">剂型：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.formName}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter1" class="col-sm-2 text-right">规格：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.specName}" />
                        </div>
                        <label for="inputTextAlter2" class="col-sm-2 text-right">转换系数：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.factor}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter1" class="col-sm-2 text-right">单位：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.unitName}" />
                        </div>
                        <label for="inputTextAlter2" class="col-sm-2 text-right">生产企业：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.compName}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter2" class="col-sm-2 text-right">批准文号：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.approvalCode}" />
                        </div>
                        <label for="inputTextAlter1" class="col-sm-2 text-right">配送企业：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.delName}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter1" class="col-sm-2 text-right">采购价格：</label>
                        <div class="col-sm-3 text-left">
                            <fmt:formatNumber type="number" value="${detail.purPrice}" pattern=".00"/>&nbsp;元
                        </div>
                        <label for="inputTextAlter2" class="col-sm-2 text-right">采购数量：</label>
                        <div class="col-sm-3 text-left">
                                <c:out value="${detail.purAmount}" />
                        </div>
                    </div>
                    <div class="line"></div>
                   <div class="form-group  form-group-xs">
                        <label for="inputTextAlter2" class="col-sm-2 text-right">备案类型：</label>
                        <div class="col-sm-3 text-left">
                            <c:if test="${detail.isLongtimePlan==1}">长期备案</c:if>
                            <c:if test="${detail.isLongtimePlan==0}">临时备案</c:if>
                        </div>
                        <label for="inputTextAlter4" class="col-sm-2 text-right">提交日期：</label>
                        <div class="col-sm-3 text-left">
                            <c:out value="${detail.bakSubmitDatetime}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter4" class="col-sm-2 text-right">备案理由：</label>
                        <div class="col-sm-10 text-left">
                            <c:out value="${detail.bakReason}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter4" class="col-sm-2 text-right">备案备注：</label>
                        <div class="col-sm-10 text-left">
                            <c:out value="${detail.remark}" />
                        </div>
                    </div>
                    <div class="line"></div>
                    <div class="form-group  form-group-xs">
                        <label for="inputTextAlter4" class="col-sm-2 text-right">审批备注：</label>
                        <div class="col-sm-10 text-left">
                            <textarea id="remark" class="textinput" style="width:80%;" maxlength="512"></textarea>
                        </div>
                    </div>
                </div>
                
                <div class="box-footer text-center">
                    <button type="button" class="btn btn-success btn-sm" onclick='auditBak(3)'>审批通过</button>
                    <button type="button" class="btn btn-success btn-sm" onclick='auditBak(4)'>审批不通过</button>
                    <button type="button" class="btn btn-danger btn-sm" onclick='history.go(-1)'>返&nbsp;回</button>
                </div>
                
            </form>
        </div>
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    
    <script type="text/javascript">
        var submitStatus = 0;
    
        function auditBak(type) {
        	var remark = $.trim($("#remark").val());
        	var url = "${ctx}/bakpurchase/wsjPassAudit.html";
        	var tips = "确认审批通过吗？";
        	if (type == 4) {
        		url = "${ctx}/bakpurchase/wsjNotPassAudit.html";
        		tips = "确认审批不通过吗？";
        		if (remark == null || remark == "") {
        			$.alert("请输入审批备注！", "warn");
        			return;
        		}
        	}
        	if (submitStatus == 1) {
                $.alert("已审批，请勿重复操作！", "warn");
                return;
            }
        	$.HN.message.confirm(tips, "", "").on(function(e) {
                if (e) {
                	submitStatus = 1;
                    $.post(url, {
                    	"bakPurId" : "${bakPurId}",
                    	"oldStatus" : "${detail.auditStatus}",
                    	"auditStatus" : type,
                    	"isLongtimePlan" : "${detail.isLongtimePlan}",
                        "remark" : remark
                    }, function(result) {
                        if (result.success) {
                            $.alert("<spring:message code="message.HN.alert.success" />", "success", function() {
                            	document.location = "${ctx}/bakpurchase/wsjAuditBakList.html";
                            });
                        } else {
                        	submitStatus = 0;
                            $.alert("<spring:message code="message.HN.alert.fail" />", "error");
                        }
                    }, "json");
                }
            });
        }
    </script>
    
</body>
</html>